<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:p="http://primefaces.org/ui"
                template="./template.xhtml">

    <ui:define name="title">
        Dialog - <span class="subitem">Dynamic Focus</span>
    </ui:define>

    <ui:define name="description">
        By default, the first input field receives focus automatically. It can be changed by using focus attribute.
    </ui:define>

    <ui:param name="documentationLink" value="/components/dialog" />

    <ui:define name="implementation">

        <h:form>         
            <p:commandButton value="Dynamic Focus" onclick="PF('dlg').show();" type="button" icon="pi pi-home" />
            
            <p:dialog header="Dynamic Focus" widgetVar="dlg" focus="age">
                <h:panelGrid columns="2" cellpadding="5">
                    <h:outputLabel for="name" value="Name:" />
                    <p:inputText id="name" label="name" />
                    
                    <h:outputLabel for="surname" value="Surname:" />
                    <p:inputText id="surname" label="surname" />
                    
                    <h:outputLabel for="age" value="Age:" />
                    <p:inputText id="age" label="age" />
                </h:panelGrid>
            </p:dialog>       
        </h:form>
        
    </ui:define>

</ui:composition>
